package com.yueze.demo1.config;


import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.io.File;


@Configuration
public class WebMvcConfig implements WebMvcConfigurer {


    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        /**
         * @Description: 对文件的路径进行配置, 创建一个虚拟路径/Path/** ，即只要在< img src="/Path/picName.jpg" />便可以直接引用图片
         *这是图片的物理路径  "file:/+本地图片的地址"
         */
        registry.addResourceHandler("/images/**").addResourceLocations("file:"+File.separator+"hzsr"+File.separator+"web"+File.separator+"save"+File.separator);
        //registry.addResourceHandler("/images/**").addResourceLocations("file:/C:/javaproject/siruan/save/");
        //"file:"+File.separator+"hzsr"+File.separator+"web"+File.separator+"save"+File.separator
        //file:/C:/javaproject/siruan/save/
    }

}